home *** CD-ROM | disk | FTP | other *** search
/ Freelog 125 / Freelog_MarsAvril2015_No125.iso / Musique / Quod Libet / quodlibet-3.3.0-portable.exe / quodlibet-3.3.0-portable / data / bin / os2emxpath.pyc (.txt) < prev    next >
Python Compiled Bytecode  |  2014-12-31  |  4KB  |  163 lines

  1. # Source Generated with Decompyle++
  2. # File: in.pyc (Python 2.7)
  3.  
  4. '''Common pathname manipulations, OS/2 EMX version.
  5.  
  6. Instead of importing this module directly, import os and refer to this
  7. module as os.path.
  8. '''
  9. import os
  10. import stat
  11. from genericpath import *
  12. from ntpath import expanduser, expandvars, isabs, islink, splitdrive, splitext, split, walk
  13. __all__ = [
  14.     'normcase',
  15.     'isabs',
  16.     'join',
  17.     'splitdrive',
  18.     'split',
  19.     'splitext',
  20.     'basename',
  21.     'dirname',
  22.     'commonprefix',
  23.     'getsize',
  24.     'getmtime',
  25.     'getatime',
  26.     'getctime',
  27.     'islink',
  28.     'exists',
  29.     'lexists',
  30.     'isdir',
  31.     'isfile',
  32.     'ismount',
  33.     'walk',
  34.     'expanduser',
  35.     'expandvars',
  36.     'normpath',
  37.     'abspath',
  38.     'splitunc',
  39.     'curdir',
  40.     'pardir',
  41.     'sep',
  42.     'pathsep',
  43.     'defpath',
  44.     'altsep',
  45.     'extsep',
  46.     'devnull',
  47.     'realpath',
  48.     'supports_unicode_filenames']
  49. curdir = '.'
  50. pardir = '..'
  51. extsep = '.'
  52. sep = '/'
  53. altsep = '\\'
  54. pathsep = ';'
  55. defpath = '.;C:\\bin'
  56. devnull = 'nul'
  57.  
  58. def normcase(s):
  59.     '''Normalize case of pathname.
  60.  
  61.     Makes all characters lowercase and all altseps into seps.'''
  62.     return s.replace('\\', '/').lower()
  63.  
  64.  
  65. def join(a, *p):
  66.     '''Join two or more pathname components, inserting sep as needed'''
  67.     path = a
  68.     for b in p:
  69.         if isabs(b):
  70.             path = b
  71.             continue
  72.         if path == '' or path[-1:] in '/\\:':
  73.             path = path + b
  74.             continue
  75.         path = path + '/' + b
  76.     
  77.     return path
  78.  
  79.  
  80. def splitunc(p):
  81.     """Split a pathname into UNC mount point and relative path specifiers.
  82.  
  83.     Return a 2-tuple (unc, rest); either part may be empty.
  84.     If unc is not empty, it has the form '//host/mount' (or similar
  85.     using backslashes).  unc+rest is always the input path.
  86.     Paths containing drive letters never have an UNC part.
  87.     """
  88.     if p[1:2] == ':':
  89.         return ('', p)
  90.     firstTwo = None[0:2]
  91.     if firstTwo == '//' or firstTwo == '\\\\':
  92.         normp = normcase(p)
  93.         index = normp.find('/', 2)
  94.         if index == -1:
  95.             return ('', p)
  96.         index = None.find('/', index + 1)
  97.         if index == -1:
  98.             index = len(p)
  99.         return (p[:index], p[index:])
  100.     return (None, p)
  101.  
  102.  
  103. def basename(p):
  104.     '''Returns the final component of a pathname'''
  105.     return split(p)[1]
  106.  
  107.  
  108. def dirname(p):
  109.     '''Returns the directory component of a pathname'''
  110.     return split(p)[0]
  111.  
  112. lexists = exists
  113.  
  114. def ismount(path):
  115.     '''Test whether a path is a mount point (defined as root of drive)'''
  116.     (unc, rest) = splitunc(path)
  117.     if unc:
  118.         return rest in ('', '/', '\\')
  119.     p = None(path)[1]
  120.     if len(p) == 1:
  121.         pass
  122.     return p[0] in '/\\'
  123.  
  124.  
  125. def normpath(path):
  126.     '''Normalize path, eliminating double slashes, etc.'''
  127.     path = path.replace('\\', '/')
  128.     (prefix, path) = splitdrive(path)
  129.     while path[:1] == '/':
  130.         prefix = prefix + '/'
  131.         path = path[1:]
  132.     comps = path.split('/')
  133.     i = 0
  134.     while i < len(comps):
  135.         if comps[i] == '.':
  136.             del comps[i]
  137.             continue
  138.         if comps[i] == '..' and i > 0 and comps[i - 1] not in ('', '..'):
  139.             del comps[i - 1:i + 1]
  140.             i = i - 1
  141.             continue
  142.         if comps[i] == '' and i > 0 and comps[i - 1] != '':
  143.             del comps[i]
  144.             continue
  145.         i = i + 1
  146.     if not prefix and not comps:
  147.         comps.append('.')
  148.     return prefix + '/'.join(comps)
  149.  
  150.  
  151. def abspath(path):
  152.     '''Return the absolute version of a path'''
  153.     if not isabs(path):
  154.         if isinstance(path, unicode):
  155.             cwd = os.getcwdu()
  156.         else:
  157.             cwd = os.getcwd()
  158.         path = join(cwd, path)
  159.     return normpath(path)
  160.  
  161. realpath = abspath
  162. supports_unicode_filenames = False
  163.